package bg.cinema_system.beans;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

@ManagedBean(name = "util")
@RequestScoped
public class UtilBean {

	public String ticketsInfo() {
		HttpSession session = (HttpSession) FacesContext.getCurrentInstance()
				.getExternalContext().getSession(false);
		int userRole = (Integer) session.getAttribute("userRole");

		System.out.println("Role - " + userRole);

		// Check if you are from the staff
		if (userRole == 2) {
			return "staff_tickets";
		} else {
			return "user_tickets";
		}
	}

}
